﻿package com.greensock.easing
{

    public class CustomEase extends Object
    {
        private var _name:String;
        private var _segments:Array;
        private static var _all:Object = {};
        public static const VERSION:Number = 1.01;

        public function CustomEase(param1:String, param2:Array)
        {
            _name = param1;
            _segments = [];
            var _loc_3:* = param2.length;
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3)
            {
                
                _segments[_segments.length] = new Segment(param2[_loc_4].s, param2[_loc_4].cp, param2[_loc_4].e);
                _loc_4++;
            }
            _all[param1] = this;
            return;
        }// end function

        public function destroy() : void
        {
            _segments = null;
            delete _all[_name];
            return;
        }// end function

        public function ease(param1:Number, param2:Number, param3:Number, param4:Number) : Number
        {
            var _loc_7:Number = NaN;
            var _loc_8:Segment = null;
            var _loc_5:* = param1 / param4;
            var _loc_6:* = _segments.length;
            var _loc_9:* = int(_loc_6 * _loc_5);
            _loc_7 = (_loc_5 - _loc_9 * (1 / _loc_6)) * _loc_6;
            _loc_8 = _segments[_loc_9];
            return param2 + param3 * (_loc_8.s + _loc_7 * (2 * (1 - _loc_7) * (_loc_8.cp - _loc_8.s) + _loc_7 * (_loc_8.e - _loc_8.s)));
        }// end function

        public static function byName(param1:String) : Function
        {
            return _all[param1].ease;
        }// end function

        public static function create(param1:String, param2:Array) : Function
        {
            var _loc_3:* = new CustomEase(param1, param2);
            return _loc_3.ease;
        }// end function

    }
}

class Segment extends Object
{
    public var s:Number;
    public var e:Number;
    public var cp:Number;

    function Segment(param1:Number, param2:Number, param3:Number)
    {
        this.s = param1;
        this.cp = param2;
        this.e = param3;
        return;
    }// end function

}

